import datetime
import re
import subprocess
# print 'popen3:'
def external_cmd(cmd, msg_in=''):   
    try:       
        proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,)        
        stdout_value, stderr_value = proc.communicate(msg_in) 
        return stdout_value, stderr_value    
    except ValueError as err:
        # log("IOError: %s" % err)       
        return None, None

if __name__ == '__main__':
    # command = 'aapt dump badging D:\Work\Python\GetWeChatID\APKSources\com.xunlei.kankan_7.1.2.3_394.apk'  # 可以直接在命令行中执行的命令
    # # stdout_val, stderr_val = external_cmd('dir')
    # # print('Standard Output: %s' % stdout_val)
    # # print('Standard Error: %s' % stderr_val)
    # file_content=subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
    # searchObj = re.search(r'package: name=\'(.*)\' versionCode=\'',
    #                       file_content,
    #                       re.M | re.I)
    # print(searchObj.group(1))
   print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
